package com.ruoyi.radar.controller;

import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.radar.common.CommonMethod;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;

@CrossOrigin
@RestController
@RequestMapping("/radarResult")
public class RadarSurfaceController {

    @Value("${url.gansu}")
    private String url;

    @Autowired
    CommonMethod commonMethod;

    //存储间隔20s

    @PostMapping("/getSurface")
    public AjaxResult add(@RequestBody HashMap<String,Object> param) {

        //获取曲面
        Object token = commonMethod.getToken();
        HttpRequest request = HttpUtil.createGet(url+"/request?token="+token+"&action=3&stockid="+param.get("stockId"));
//        HttpRequest request = HttpUtil.createGet(url+"/request?token="+token+"&action=2");

        String body = request.execute().body();


        return AjaxResult.success(body);
    }
}
